-- card: 9755 from stack: in -- bmap block id: 10047 -- flags: 0000 -- background id: 2696 -- name: Match Key Objects ----- HyperTalk script ----- -- This card is for matching sets of words to key words -- For example, matching words that rhyme with the key word -- Each key word has a "bucket" that the matching words go into -- The nifty part is that you can change it to use your own words -- -- Setting up the key words and matching words is simple: -- 1) type "author" into the message box (a field and a button named -- "Process" will appear) -- 2) on separate lines in the field, put a key word, followed by the -- matching words, each separated by a comma -- 3) click the "Process" button -- -- For example, to set up a simple ryhming exercise with frog and -- cat as the key words, you would type -- frog,dog,log -- cat,sat,mat,hat -- -- You can actually use more than one word as a "word", but you may -- have to change the fWidth variable in the process script to make -- the word fields bigger. -- created by Jim Taylor 4/27/89 -- Microcomputer Support for Curriculum -- 101 HRCB, Brigham Young University, Provo, UT 84602 -- taylorj@byuvax.bitnet -- -- This code has been released into the public domain. on openCard global numRight put 0 into numRight pass openCard end openCard -- Clean things up if anything was done on closeCard global numRight if numRight > 0 then cleanUp pass closeCard end closeCard -- Empty the buckets, unhide all the words, and reset the score on cleanUp global numRight lock screen repeat with n = 1 to the number of lines in card field "Table" put "Bucket" && n into fName put empty into card field fName end repeat repeat with n = 1 to card field "numWords" put "Word" && n into wfName show card field wfName end repeat put 0 into numRight end cleanUp on author show button "Process" show card field "Table" select card field "Table" type "+" with commandKey, shiftKey -- bring the field to the front choose browse tool end author on mouseDown get the short name of the target if word 1 of it is "Word" then moveWord end mouseDown -- Let the user move the selected word's field. If he puts it in the -- right bucket, add the word to the bucket and hide the field. on moveWord global numRight put the loc of the target into startLoc repeat until the mouse is up show the target at the mouseLoc end repeat put the mouseLoc into endLoc -- surround word by commas to prevent spurious matches put "," & target & "," into theWord -- go through the table to see if the word is in the right bucket repeat with n = 1 to the number of lines in card field "Table" if theWord is in line n of card field "Table" then put "Bucket" && n into fName if endLoc is within the rect of card field fName then -- correct hide the target -- add the word to the bucket if card field fName is empty then put target into card field fName else put " - " & target after card field fName end if -- update the score and see if all done add 1 to numRight if numRight = card field "NumWords" then -- all correct! rightSound -- cleanUp -- (if you want to let them do it again) end if end if exit repeat end if end repeat set the loc of the target to startLoc -- put the word's field back end moveWord -- part 2 (button) -- low flags: 80 -- high flags: A003 -- rect: left=325 top=312 right=334 bottom=425 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Process ----- HyperTalk script ----- -- Go through the table, building new key fields, bucket fields, and -- word fields. on mouseUp global list hide card field "Table" -- lock screen -- uncomment to speed things up -- delete old fields repeat with f = the number of card fields down to 1 if word 1 of the short name of card field f is in "Word Key Bucket" then show card field f select card field f doMenu "Clear Field" end if end repeat -- get rid of blank lines at end of field repeat until last line of card field "Table" is not empty delete last line of card field "Table" if card field "Table" is empty then beep exit mouseUp end if end repeat -- make keys and buckets for each line in the table, and put the -- words into a master list put 18 into fHeight -- height of key & bucket fields put 70 into fWidth -- width of key fields put 22 into fSpace -- spacing of key & bucket fields put 80 into starty -- topmost starting location of fields put 350 into startx -- leftmost starting location of word fields put empty into list repeat with n = 1 to the number of lines in card field "Table" put line n of card field "Table" into theLine -- remove spaces after items put offset(", ", theLine) into i repeat until i = 0 delete char i+1 of theLine put offset(", ", theLine) into i end repeat -- make sure each line has a trailing comma if last char of theLine ≠ "," then put "," after theLine -- remove spaces before items put offset(" ,", theLine) into i repeat until i = 0 delete char i of theLine put offset(" ,", theLine) into i end repeat -- put the cleaned up line back in the table put theLine into line n of card field "Table" -- add words to master list put the number of items in theLine into lastItem put item 2 to lastItem of theLine & "," after list -- make key fields and bucket fields put (n-1)*fSpace+starty into y doMenu "New Field" set the rect of last card field to 0,y,fWidth,y+fHeight set the name of last card field to "Key" && n set the lockText of last card field to true set the textStyle of last card field to bold set the textAlign of last card field to right put item 1 of theLine into last card field doMenu "New Field" set the rect of last card field to fwidth+2,y,startx-10,y+fHeight set the name of last card field to "Bucket" && n set the style of last card field to rectangle set the lockText of last card field to true end repeat -- permanently remember the number of words put the number of items in list into card field "NumWords" -- randomly remove words from the master list and put them in fields put 17 into fHeight -- height of word fields put 54 into fWidth -- width of word fields put startx into x put starty into y repeat with w = 1 to card field "NumWords" put random(number of items in list) into itemNum put item itemNum of list into theWord delete item itemNum of list doMenu "New Field" set the textAlign of last card field to center set the lockText of last card field to true set the rect of last card field to x,y,x+fWidth,y+fHeight set the name of last card field to "Word" && w put theWord into last card field add fWidth to x if x > 512-fWidth then put startx into x add fHeight to y end if end repeat hide me choose browse tool end mouseUp -- part 9 (field) -- low flags: 81 -- high flags: 0000 -- rect: left=0 top=0 right=21 bottom=43 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: NumWords -- part 27 (field) -- low flags: 01 -- high flags: 2002 -- rect: left=87 top=208 right=277 bottom=433 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: -- part 1 (field) -- low flags: 80 -- high flags: 0004 -- rect: left=32 top=64 right=297 bottom=386 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Table -- part 259 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=0 top=80 right=98 bottom=70 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 65535 -- font id: 3 -- text size: 12 -- style flags: 256 -- line height: 16 -- part name: Key 1 -- part 260 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=72 top=80 right=98 bottom=340 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Bucket 1 -- part 261 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=0 top=102 right=120 bottom=70 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 65535 -- font id: 3 -- text size: 12 -- style flags: 256 -- line height: 16 -- part name: Key 2 -- part 262 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=72 top=102 right=120 bottom=340 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Bucket 2 -- part 263 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=0 top=124 right=142 bottom=70 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 65535 -- font id: 3 -- text size: 12 -- style flags: 256 -- line height: 16 -- part name: Key 3 -- part 264 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=72 top=124 right=142 bottom=340 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Bucket 3 -- part 265 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=350 top=80 right=97 bottom=404 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 1 -- part 266 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=404 top=80 right=97 bottom=458 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 2 -- part 267 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=458 top=80 right=97 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 3 -- part 268 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=350 top=97 right=114 bottom=404 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 4 -- part 269 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=404 top=97 right=114 bottom=458 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 5 -- part 270 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=458 top=97 right=114 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 6 -- part 271 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=350 top=114 right=131 bottom=404 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 7 -- part 272 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=404 top=114 right=131 bottom=458 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 8 -- part 273 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=458 top=114 right=131 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 9 -- part 274 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=350 top=131 right=148 bottom=404 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word 10 -- part 275 (field) -- low flags: 81 -- high flags: 2004 -- rect: left=92 top=152 right=264 bottom=352 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Info ----- HyperTalk script ----- on mouseUp info end mouseUp -- part 276 (button) -- low flags: 00 -- high flags: 2001 -- rect: left=490 top=320 right=342 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 26635 / 26635 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ----- HyperTalk script ----- on mouseUp info end mouseUp -- part contents for card part 1 ----- text ----- far,bar,car,jar,par,tar,czar,mar, cat,sat,fat, hog,frog, -- part contents for card part 9 ----- text ----- 10 -- part contents for card part 27 ----- text ----- Drag the words on the right into the boxes next to the words they rhyme with. -- part contents for card part 259 ----- text ----- far -- part contents for card part 261 ----- text ----- cat -- part contents for card part 263 ----- text ----- hog -- part contents for card part 265 ----- text ----- czar -- part contents for card part 266 ----- text ----- car -- part contents for card part 267 ----- text ----- jar -- part contents for card part 268 ----- text ----- par -- part contents for card part 269 ----- text ----- tar -- part contents for card part 270 ----- text ----- sat -- part contents for card part 271 ----- text ----- mar -- part contents for card part 272 ----- text ----- frog -- part contents for card part 273 ----- text ----- bar -- part contents for card part 274 ----- text ----- fat -- part contents for card part 275 ----- text ----- This card is designed so you can copy it and easily change the words to fit your needs. See the card script for details.